package com.ysqcould.message.service.impl;


import com.ysqcould.common.utils.DateUtils;
import com.ysqcould.message.domain.Invoice;
import com.ysqcould.message.mapper.InvoiceMapper;
import com.ysqcould.message.service.IInvoiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 发票申请Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-30
 */
@Service
public class InvoiceServiceImpl implements IInvoiceService
{
    @Autowired
    private InvoiceMapper invoiceMapper;

    /**
     * 查询发票申请
     * 
     * @param id 发票申请主键
     * @return 发票申请
     */
    @Override
    public Invoice selectInvoiceById(Long id)
    {
        return invoiceMapper.selectInvoiceById(id);
    }

    /**
     * 查询发票申请列表
     * 
     * @param invoice 发票申请
     * @return 发票申请
     */
    @Override
    public List<Invoice> selectInvoiceList(Invoice invoice)
    {
        return invoiceMapper.selectInvoiceList(invoice);
    }

    /**
     * 新增发票申请
     * 
     * @param invoice 发票申请
     * @return 结果
     */
    @Override
    public int insertInvoice(Invoice invoice)
    {
        invoice.setCreateTime(DateUtils.getNowDate());
        return invoiceMapper.insertInvoice(invoice);
    }

    /**
     * 修改发票申请
     * 
     * @param invoice 发票申请
     * @return 结果
     */
    @Override
    public int updateInvoice(Invoice invoice)
    {
        invoice.setUpdateTime(DateUtils.getNowDate());
        return invoiceMapper.updateInvoice(invoice);
    }

    /**
     * 批量删除发票申请
     * 
     * @param ids 需要删除的发票申请主键
     * @return 结果
     */
    @Override
    public int deleteInvoiceByIds(Long[] ids)
    {
        return invoiceMapper.deleteInvoiceByIds(ids);
    }

    /**
     * 删除发票申请信息
     * 
     * @param id 发票申请主键
     * @return 结果
     */
    @Override
    public int deleteInvoiceById(Long id)
    {
        return invoiceMapper.deleteInvoiceById(id);
    }
}
